/**
 * 
 */
package gwtool.drucken;

import gwtool.container.DataSetItem;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.util.List;

/**
 * @author Christian
 * 
 */
public class DruckController {

	public void zeigeDruckVorschau(List<DataSetItem> list) {

	}

	public void druckeItem(List<DataSetItem> list) {

		PrinterJob pjob = PrinterJob.getPrinterJob();
		if (pjob.printDialog() == false)
			return;
		Printable printable = new DruckItemListe(list);

		pjob.setPrintable(printable);

		try {
			// Toolkit tk = Toolkit.getDefaultToolkit();
			// PrintJob pj = tk.getPrintJob(new JFrame(), "", null);
			// int res = pj.getPageResolution();
			// Dimension d = pj.getPageDimension();
			// System.out.println("Resolution : " + res + "\n" + "Width : " +
			// d.width + "\n"
			// + "Height : " + d.height + "\n" + "Pixel on page : "
			// + (res * d.width * d.height));
			pjob.print();
		} catch (PrinterException e) {
			e.printStackTrace();
		}
	}

}
